<%@page  contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<html:html lang="true">
<%int i_ini = 8;%>
<%int i_end = 21;%>
<%int i_beginT = 0;%>
<%int i_difTime = 0;%>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>ตารางสอน</title>
    </head>
    <body>
        <html:form action="/previewSchedule.do?dispatch=doPreviewSchedule">
            <table class="three" cellspacing="0">
                    <tr>
                        <td colspan="14" bgcolor="#E2E7EB" class="Font"><div align="center"><strong>ตารางสอนของ</strong> ${staffSchedulForm.teachName}<strong>  ตำแหน่ง</strong> ${staffSchedulForm.position} <br><strong>สังกัดภาควิชา </strong>${staffSchedulForm.depName} <strong>คณะ</strong> ${staffSchedulForm.facName} </div></td>
                    </tr>
                    <tr>
                        <td colspan="14" bgcolor="#E2E7EB" class="Font"><div align="center"><strong>ประจำภาคการศีกษา</strong> ${staffSchedulForm.semAcademicYear} <strong>ปีการศึกษา</strong> ${staffSchedulForm.semSemester}</div></td>
                    </tr>                   
            </table>
           <table border="1" cellpadding="0" cellspacing="0" align="center">
                    <tr>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">วัน/เวลา</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;08-09&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;09-10&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;10-11&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;11-12&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;12-13&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;13-14&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;14-15&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;15-16&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;16-17&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;17-18&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;18-19&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;19-20&nbsp;</div></td>
                      <td bgcolor="#f1f3f5" class="table"><div align="center">&nbsp;20-21&nbsp;</div></td>
                    </tr> 
                    <tr>
                      <td height="45" bgcolor="#f1f3f5" class="table">จันทร์ </td>
                      <logic:empty name="staffSchedulForm" property="monTableList">
                           <%i_ini = 8;%>
                           <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                      <logic:notEmpty name="staffSchedulForm" property="monTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="monTableList" indexId="seq" >
                               <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                                i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>
                    </tr>
                    <tr>
                      <td height="45" bgcolor="#f1f3f5" class="table">อังคาร</td>
                      <logic:empty name="staffSchedulForm" property="tueTableList">
                          <%i_ini = 8;%>
                          <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                       <logic:notEmpty name="staffSchedulForm" property="tueTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="tueTableList" indexId="seq" >
                                <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                               i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>
                    </tr>
                    <tr>
                      <td height="41" bgcolor="#f1f3f5" class="table">พุธ</td>
                      <logic:empty name="staffSchedulForm" property="wedTableList">
                           <%i_ini = 8;%>
                           <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                       <logic:notEmpty name="staffSchedulForm" property="wedTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="wedTableList" indexId="seq" >
                                <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                                 i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>                   
                    </tr>
                    <tr>
                      <td height="42" bgcolor="#f1f3f5" class="table">พฤหัสฯ</td>
                       <logic:empty name="staffSchedulForm" property="thuTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                      <logic:notEmpty name="staffSchedulForm" property="thuTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="thuTableList" indexId="seq" >
                                <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                                i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>
                    </tr>
                    <tr>
                      <td height="43" bgcolor="#f1f3f5" class="table">ศุกร์</td>
                       <logic:empty name="staffSchedulForm" property="friTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                     <logic:notEmpty name="staffSchedulForm" property="friTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="friTableList" indexId="seq" >
                                <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                                 i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>
                     
                    </tr>
                    <tr>
                      <td height="46" bgcolor="#f1f3f5" class="table">เสาร์</td>
                       <logic:empty name="staffSchedulForm" property="satTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                       <logic:notEmpty name="staffSchedulForm" property="satTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="satTableList" indexId="seq" >
                                <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                                i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>
                    
                    </tr>
                    <tr>
                      <td height="42" bgcolor="#f1f3f5" class="table">อาทิตย์</td>
                       <logic:empty name="staffSchedulForm" property="sunTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                          <%for(int i=i_ini;i<i_end;i++){%>
                          <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                            <%}%>
                      </logic:empty>
                      <logic:notEmpty name="staffSchedulForm" property="sunTableList">
                            <%i_ini = 8;%>
                            <%i_end = 21;%>
                            <logic:iterate id="list" name="staffSchedulForm" property="sunTableList" indexId="seq" >
                                <bean:define id="int_BeginTime" name="list" property="noBeginTime" type="java.lang.String"/>
                                <bean:define id="int_difTime" name="list" property="difTime" type="java.lang.String"/>
                                <%
                                i_beginT = java.lang.Integer.valueOf(int_BeginTime);
                                i_difTime = java.lang.Integer.valueOf(int_difTime);
                                for(;i_ini<i_beginT;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                                <%if(i_ini==i_beginT){%>
                                <td colspan="<%=int_difTime%>" bgcolor="#707070" class="table"><div align="center"><span ><span ><a href="edit_schedule_staff.html"><bean:write name="list" property="SUB_ID"/></a></span></span> <br /><a href="edit_schedule_staff.html"> <span ><span >ห้อง <bean:write name="list" property="LOC_Room"/></span></span></a><span class="Font"><span class="table2"></span></span></div></td>
                                <%
                                i_ini += i_difTime;
                                }%>
                            </logic:iterate>  
                                <% for(;i_ini<i_end;i_ini++){%>
                                   <td bgcolor="#f1f3f5" class="table">&nbsp;</td>
                                <%}%>
                      </logic:notEmpty>
                    </tr>
            </table>
        </html:form>
    </body>
</html:html>
